Rooting Android Device with Magisk

Rooting is the process of allowing users of smartphones, tablets and other devices running the Android mobile operating system to attain privileged control (known as root access) over various Android subsystems. As Android uses the Linux kernel, rooting an Android device gives similar access to administrative (superuser) permissions as on Linux or any other Unix-like operating system such as FreeBSD or OS X.

Rooting method depends on phone manufacturer. Some of them provide unlocked bootloader, thus allowing to boot custom firmware. Some manufacturers require special agreement, where end-user loose phone warranty. Sometimes bootloader is locked by manufacturer and nothing can be done with that.

In case of unlocked bootloaderuser is able to boot custom firmware and modify root filesystem by simply adding su binary. In case of locked bootloader, it’s more complicated. Attacker have to find and exploit vulnerability in software, which will grant regular user admin rights. This could achieved by exploiting weaknesses in highly privileged services or kernel.

Rooting Android Device with Magisk

Rooting Android Device Using Magisk

  1. Download the firmware from official website of your mobile corresponding to your device model.
  2. Go to folder image and copy the init_boot.img file to the internal Storage of the device.
  3. Download and install latest Magisk Manager Application in the phone.

Releases · topjohnwu/Magisk

The Magic Mask for Android. Contribute to topjohnwu/Magisk development by creating an account on GitHub.

Download latest version from github Releases · topjohnwu/Magisk

  1. Update the application to install latest version.

Update Magisk Manager

Updated Magisk Manager successfully

  1. Tap on Install option.

Click on Install

  1. Select Select and Patch a file option and select the init_boot.img file.

Click on next and follow the instructions

  1. Now it will Patch the file and keep a new one in the Download directory of the internal Storage.

Patching done

  1. Copy the patched file to the system where fastboot is installed.
  2. Now go to settings -> Developer Options -> Enable OEM Unlocking.

Enable OEM Unlocking

  1. Now Enter the command in kali to check for the connected device.
    adb devices
    
  2. Now enter below command to get into “fast mode”
    adb reboot bootloader
    
  3. Connect the Android devise using usb cable in kali and then run the below command to check the device is detected in “fastboot”.

    fastboot devices
    
    Check if device connected to the system

  4. Enter the below command to unlock the bootloader

    fastboot flash init_boot <init_file location>
    
    Flash the init file with fastboot

  5. Note that the flashing process is completed, enter the following command to reboot.

    fastboot reboot
    
    Reboot your device

Enjoy, your device is rooted now. Check the device root status with Root Checker app.